test-pull-untrusted.sh: always corrupt a regular file, not a symlink
authorJonathan Lebon <jlebon@redhat.com>
Thu, 31 Mar 2016 13:07:01 +0000 (14:07 +0100)
committerColin Walters (automation) <walters+githubbot@verbum.org>
Thu, 31 Mar 2016 14:22:06 +0000 (14:22 +0000)
test-pull-untrusted.sh would pass when run as root, but fail when run
as testuser. It turned out that the way the files were stored in the
repo when running as a testuser were different, which meant that a
different .file object was chosen for corruption. Except that file
turned out to be a symlink, so the echo "broke" actually just wrote
to the no_such_file symlink target, thus keeping the actual symlink
file's checksum the same and causing the pull-local to pass when it
should have failed.

[smcv: split this out of a larger commit, part of PR #231]
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #232
Approved by: cgwalters

tests/test-pull-untrusted.sh

index 95f7ab932d1f1d32bea6ae8f8cd5f9260f5a2487..536362247f7dbef1d761ba5faf7b7c3a74a30aa8 100755 (executable)
@@ -39,6 +39,12 @@ echo "ok pull-local --untrusted didn't hardlink"
 
 # Corrupt repo
 for i in ${test_tmpdir}/repo/objects/*/*.file; do
+
+    # make sure it's not a symlink
+    if [ -L $i ]; then
+        continue
+    fi
+
     echo "corrupting $i"
     echo "broke" >> $i
     break;